﻿using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using ZZQFrameWork;

public class MessageBox:MonoBehaviour
{
    /// <summary>
    /// 标题
    /// </summary>
    private Text titleText;

    /// <summary>
    /// 内容
    /// </summary>
    private Text contentText;

    /// <summary>
    /// 确定按钮
    /// </summary>
    private GameObject sureButton;

    void Awake()
    {
        
        EventTriggerListener.Get(sureButton).SetEventHandle(Enum_TouchEventType.OnClick, OnSureButtonClick);
    }

    /// <summary>
    /// 设置标题
    /// </summary>
    /// <param name="title"></param>
    public void SetTitle(string title)
    {
        titleText.text = title;
    }

    /// <summary>
    /// 设置内容
    /// </summary>
    /// <param name="content"></param>
    public void SetContent(string content)
    {
        contentText.text = content;
    }

    /// <summary>
    /// 点击确定按钮
    /// </summary>
    /// <param name="_listener"></param>
    /// <param name="_args"></param>
    /// <param name="_params"></param>
    private void OnSureButtonClick(GameObject _listener, object _args, object[] _params)
    {
        Hide();
    }

    /// <summary>
    /// 显示
    /// </summary>
    public void Show()
    {
        gameObject.SetActive(true);
    }

    /// <summary>
    /// 隐藏
    /// </summary>
    public void Hide()
    {
        gameObject.SetActive(false);
    }
}
